#include "tcpServer.hpp"
#include <iostream>
#include <memory>

#include "deamon.hpp"

using namespace std;
using namespace Server;

void heandler(const std::string& ip, const uint16_t& port)
{
    //
}

inline void Usage(std::string proc)
{
    std::cout << "Usage : \n\t" << proc << " local_port\n\n";
}

int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }

    uint16_t port = atoi(argv[1]);

    unique_ptr<TcpServer> tcpServer(new TcpServer(heandler));
    tcpServer->init();

    deamonSelf();

    tcpServer->start();

    return 0;
}